<template>
  <div>
    <a-card :bordered="false" title="基本信息">
      <dictionaryType-form
        :dictionary-type-id="dictionaryTypeId"
        @codeItemIdChange="codeItemIdChange"
      ></dictionaryType-form>
    </a-card>
    <a-card
      :bordered="false"
      title="字典项信息"
      class="marginTop20"
      v-if="dictionaryTypeId && codeItemId"
    >
      <dictionary-list :code-item-id="codeItemId"></dictionary-list>
    </a-card>
  </div>
</template>
<script>
import { dictionaryTypeListUrl } from "@/api/cms/dictionaryType";
import DictionaryTypeForm from "@/views/cms/dictionaryType/component/dictionaryTypeForm";
import DictionaryList from "@/views/cms/dictionaryType/component/dictionaryList";
export default {
  components: { DictionaryTypeForm, DictionaryList },
  data() {
    return {
      backUrl: dictionaryTypeListUrl,
      dictionaryTypeId: this.$route.params.id,
      codeItemId: undefined
    };
  },
  methods: {
    codeItemIdChange(val) {
      this.codeItemId = val;
    }
  }
};
</script>